<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@page import="com.lmpop.trade.ti_address.*" %>
<%@page import="java.util.*" %>
<%@page import="com.lmpop.trade.ts_area.*" %>
<%@page import="com.lmpop.frame.util.PageTools" %>


<%

	request.setCharacterEncoding("UTF-8");
	Ts_areaInfo areaBean = new Ts_areaInfo();
	Map ti_address = new Hashtable();
	Ti_addressInfo ti_addressInfo = new Ti_addressInfo();
	String iStart = "0";
	int limit = 20;
	ti_address.put("user_id",_user_id);
	if(request.getParameter("iStart")!=null) iStart = request.getParameter("iStart");
	List list = ti_addressInfo.getListByPage(ti_address,Integer.parseInt(iStart),limit);
	//int counter = ti_addressInfo.getCountByObj(ti_address);
	//String pageString = new PageTools().getGoogleToolsBar(counter,"index.jsp?iStart=",Integer.parseInt(iStart),limit);

	int listsize = 0;
	if(list!=null && list.size()>0){
		listsize = list.size();
	}

%>

	<script language="javascript" type="text/javascript" src="/program/plugins/calendar/WdatePicker.js"></script>
	<script language="javascript" type="text/javascript" src="commen.js"></script>
	<script type="text/javascript" src="/js/commen.js"></script>


<script language="javascript" type="text/javascript">
<!--//--><![CDATA[//><!--
function mover(src,clrOver){
	src.bgColor = clrOver;
}
function mout(src,clrout)  {
	src.bgColor = clrout;
}
function GetObj(objName){if(document.getElementById){return eval('document.getElementById("'+objName+'")')}else{return eval('document.all.'+objName)}}
//--><!]]>
</script>


<div class="f-right ">
    <table width="100%" border="0" cellspacing="0" cellpadding="0" >
      <tr>
        <td><table width="100%" border="0" cellpadding="0" cellspacing="0" class="table_main" >
            <tr>
              <th width="5%" height="40" align="center"><img src="/program/member/index/images/icon1.gif" /></th>
              <th width="75%"><h3>我的收货地址</h3></th>
              <th width="13%">
				<%
				if(listsize <5 ){
				%>
					<a href="addViewIndex.jsp?menu_id=<%=menu_id%>" class="cZs">新增收货地址>></a>
				<%
				}else if(listsize>=5){
					out.println("您的地址薄已满。");
				}
				%>
			  </th>
            </tr>
          </table>

<div class="ts"><img src="/program/member/index/images/ts.gif" />
	&nbsp;您最多可以添加5个收获地址。您在提交订单页面，系统会默认把收获排序数字最大的作为您的默认收获地址。</div>
	
		</form>		  
		
	<% 
		if(list!=null && list.size()>0){
	%>

          <table width="100%" border="0"   cellspacing="0" cellpadding="2" height="33" class="table_ls" >
            <tr>
              <th width="10%" align="left">收货人</th>
              <th width="15%" align="left">所在地区</th>
              <th width="25%" align="left">街道地址</th>
			  <th width="15%" align="center">联系电话</th>
			  <th width="10%" align="left">排序</th>
			  <th width="10%" align="left">修改</th>
              <th width="10%" align="left">删除</th>
            </tr>
          </table>
         
		 <% 
				  		for(int i=0;i<list.size();i++){
		  			Hashtable map = (Hashtable)list.get(i);
		  			String addr_id="",consignee="",infolevel="",email="",area_attr="",address="",post_code="",tel="",cellphone="",sign_building="",best_time="",v_user_id="",in_date="";
		  			  	if(map.get("addr_id")!=null) addr_id = map.get("addr_id").toString();
						if(map.get("consignee")!=null) consignee = map.get("consignee").toString();
						if(map.get("level_no")!=null) infolevel = map.get("level_no").toString();
						if(map.get("email")!=null) email = map.get("email").toString();
						if(map.get("area_attr")!=null) area_attr = map.get("area_attr").toString();
						if(map.get("address")!=null) address = map.get("address").toString();
						if(map.get("tel")!=null) tel = map.get("tel").toString();
						if(map.get("cellphone")!=null) cellphone = map.get("cellphone").toString();
						String areaAttr = "",areaoutput="";
						if (map.get("area_attr") != null) {
						area_attr = map.get("area_attr").toString();
						String areaArr[] = area_attr.split("\\|");
							for( int k = 0; k < areaArr.length; k++ ){
								areaoutput +=  areaBean.getAreaNameById( areaArr[k]) + "  ";	 		
							}
						}

		  %>
		 
		  <table width="100%" border="0" cellpadding="0" cellspacing="0" class="table_list">
            


		
			<input type="hidden" name="s_area_attr" id  ="s_area_attr" value="<%=area_attr%>">
			<input type="hidden" name="s_addr_id" id  ="s_addr_id" value="<%=addr_id%>">
			<input type="hidden" name="s_tel" id  ="s_tel" value="<%=tel%>">
			<input type="hidden" name="s_cellphone" id  ="s_cellphone" value="<%=cellphone%>">
            <tr height="40" onMouseOut="mout(this,'#ffffff');" onMouseOver="mover(this,'#F9F4F8');">
              <td width="10%" align="left" >
			  <span id="s_consignee"><%=consignee%></span>
			  </td>
              <td width="15%" align="left">
			  <span id="s_areaoutput"><%=areaoutput%></span>
			  </td>
              <td width="25%" align="left">
			 <span id="s_address"><%=address%></span>
			  </td>
              <td width="15%" align="center">
			 <span id="s_post_code"><%=tel%><br/><%=cellphone%></span>
			  </td>		  
              <td width="10%" align="left">
			<span id="s_infolevel"><%=infolevel%></span>
			  </td>
              <td width="10%" align="left">
				<a href="modifyViewIndex.jsp?addr_id=<%=addr_id%>&menu_id=<%=menu_id%>" ><img src="/program/member/index/images/edit.gif" border="0"/></a>
			  </a>
			  </td>
			  <td width="10%" align="left">
				<a href="#" onclick="javascript:deleteOneInfo('<%=addr_id%>','1030');"><img src="/program/member/index/images/delete.gif" border="0"/></a>
			  </td>
            </tr>
		  <%
		  		}
		  %>


          </table>


          
	<%
		 }
	%>
		  </td>
      </tr>
    </table>
   
  </div>